Hi everybody.
I have set on KmotionCNC the M3 to Exec/wait/sync a C program, in order to lower the Z axis until it closes a contact and then resume the motion. It works fine, except when i set the Resume button the same way exec/wait/sync the same C program, as on M3 the execution freezes, it waits for ever the C program to finish but the C program at the first functions stalls and nothing happens. When i set the Resume button to just execute the c program then the c program executes all the way and finishes, but also the gcode is running and this is something i don't want. The gcode should wait the C program to finish first and then continue.
I have attached the C program. I set the M3 to run the C program on thread 2 and the resume button on thread 4.
Please advice what i'm doing wrong.